import java.io.*;

public class TransformStream {
    public static void main(String[] args) {
        try {
            FileInputStream fileInputStream = new FileInputStream("reverse.txt");
            FileOutputStream fileOutputStream = new FileOutputStream("result.txt");

            InputStreamReader inputStreamReader = new InputStreamReader(fileInputStream);
            OutputStreamWriter outputStreamWriter = new OutputStreamWriter(fileOutputStream);


            BufferedReader bufferedReader = new BufferedReader(inputStreamReader);
            BufferedWriter bufferedWriter = new BufferedWriter(outputStreamWriter);

            String line = bufferedReader.readLine();
            bufferedWriter.write(line + line);
            bufferedWriter.flush();

            bufferedReader.close();
            bufferedWriter.close();
            inputStreamReader.close();
            outputStreamWriter.close();
            fileInputStream.close();
            fileOutputStream.close();

        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
